Repository navigation
mcpx: a cancelled task's inner call is not an unknown write outcome (#8922) - #11279
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…8922) The tasks-* conformance scenarios cascade-failed from one ledger record: the suite creates a task, cancels it as cleanup, and the in-flight upstream call aborts with a plain cancellation error, which callWithLedger recorded as an unknown write outcome -- refusing every later non-read-only call to that server. A tasks/cancel is a protocol-level disposition owned by the task store (the task reads back as cancelled), so the outcome is accounted for, not unknown. The mark that a call is a task's inner call now reaches the ledger on all three daemon call paths: in-process (mcpserver.WithinTask), across the daemon API (X-Mcpx-Task-Execution, restored like the caller-protocol header and carried by value into ask-task contexts), and retroactively for interruptible (ask) calls -- an asked call starts before its task exists, so the task's cancellation flags the ask id through the abandon route before the cancel lands. Also accept a substantive in-line CallToolResult from a legacy task-augmented call: a server may answer at once when the tool finishes immediately (the fixture's failing_job does), and the synthetic malformed-response error was itself being recorded as an unknown outcome. Shapeless answers keep the malformed error. Unmarked cancelled calls still record, exactly as before.
016f9a4 to
acf422c
Compare
|
Review/verification status at merge time:
Merging under the queue's standing criteria; the deciding verification for #8922 is the post-merge nine-leg conformance run, dispatched next. |
Refs #8922 (root-cause analysis posted on the issue before this PR, per the packet: #8922 (comment))
What was wrong
Post-#11188 conformance (run 44070866395) left
server-allandserver-2026-07-28failing 17 checks each, every one in tasks-* scenarios. Reproduced locally against the pinned suite; three defects, one cascade:slow_compute), then sendstasks/cancelas cleanup. The in-flight call aborts with a plain cancellation error;callWithLedgerrecorded an unknown write outcome (ledger:{server: "tasks", tool: "slow_compute", surface: "call"}), refusing every later non-read-only call totasksand cascading through seven more scenarios. Atasks/cancelis a disposition the task store owns — the task reads backcancelled— so the outcome is accounted for, not unknown.{"taskCancelled": true}), marked in the daemon's ask table before the cancel lands.failing_job(taskSupportrequired) is answered in line with a plainCallToolResult(isError) — permitted by the extension — butcallToolAsLegacyTaskcalled it malformed, and that synthetic error was recorded as an unknown outcome too. Substantive in-line results are now accepted; shapeless answers keep the malformed error (TestLegacyTaskFaultAndMalformedcontract preserved).The fix
mcpserver: export the within-task mark (MarkWithinTask/WithinTask);driveAskedabandons through a task-awareAbandonTaskwhen the driver offers it.mcpclient:WithTaskExecution/TaskExecutionFrommarker; in-line result acceptance above.cli: direct and interruptible paths translate the mark; the daemon client serializes it asX-Mcpx-Task-Execution(mirroringX-Mcpx-Caller-Protocol).daemon: header restored inwithClientCaps, carried by value into ask-task contexts; abandon route flags the ask table;callWithLedgerskips recording for a task inner call whose context was cancelled, on any path. Unmarked cancelled calls still record.Verification
TestCallWithLedgerTaskCancellationDoesNotRecordUnknownOutcome(in-process + header-restored marks, unmarked control),TestCallWithLedgerAskTaskCancellationDoesNotRecordUnknownOutcome(flagged vs unflagged ask).go testgreen:internal/daemon,internal/mcpclient,internal/mcpserver,internal/cli;go build ./....Refs, notFixes: #8922 closes only after a post-merge conformance run shows all nine legs green.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.